package com.wc.alorithm_blue_bridge_history.fourteen.棋盘;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

/**
 * @Author congege
 * @Description
 * @Date Created in 2023/11/20-19:53
 * 棋盘
 * https://www.dotcpp.com/oj/problem3180.html
 */
public class Main {
    public static void main(String[] args) {
        Input sc = new Input();
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] a = new int[n + 5][n + 5];
        int[][] b = new int[n + 5][n + 5];
        while (m-- > 0) {
            int up = sc.nextInt();
            int left = sc.nextInt();
            int down = sc.nextInt();
            int right = sc.nextInt();
            for (int i = up; i <= down; i++) {
                b[i][left] += 1;
                b[i][right + 1] -= 1;
            }
        }
        StringBuffer ans = new StringBuffer();
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                a[i][j] = a[i][j - 1] + b[i][j];
                ans.append(a[i][j] % 2);
            }
            ans.append('\n');
        }
        System.out.print(ans);
    }

    static class Input {
        StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));

        public int nextInt() {
            try {
                in.nextToken();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (int) in.nval;
        }
    }
}
